<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-group-add">
            <input name="groupid" th:value="${groupid}" type="hidden">
            <label class="check-box" th:each="item : ${sysright}">
                <input type="checkbox"  th:value="${item.rightid}" th:checked="${item.check}" /><span th:text="${item.rightname}" th:remove="tag"></span>
            </label>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/group"
        $("#form-group-add").validate({
            focusCleanup: true,
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-group-add").serializeArray();
                var checkedItems = $('input[type="checkbox"]:checked');
                var arr=[];
                checkedItems.each(function() {
                    arr.push($(this).val());
                });
                //data.({"name":"right"});
                data.push({"name":"rights","value":arr.join(",")});
                $.operate.save(prefix + "/editprivilege", data);
            }
        }

    </script>
</body>
</html>